﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CountryCategory.aspx.cs" Inherits="UI_Bas_CountryCategory" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>国家区域维护</title> 
    <link href="../../css/admin.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery.easyui/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
  
    <script type ="text/javascript" >
        $(function () {

            var defaultDate = Date.parse('1900/01/01');
            var _$country = $("#country");
            _$country.datagrid({
                border: true,
                height: 345,
                title: '国家列表...',
                remoteSort: false,
                nowrap: true,
                striped: false,
                url: "../../TableHanders.aspx?act=q&tid=51&type=0",
                sortName: 'Id',
                sortOrder: 'asc',
                loadMsg: "正在加载,请稍后...",
                toolbar: [{
                    text: 'Add',
                    iconCls: 'icon-add',
                    handler: function () {
                        window.location.href = "CountryCategoryDetail.aspx?act=I";
                        return false;
                    }
                }],
                columns: [[
                    { title: 'Operation', field: 'opt', width: 80, align: 'center',
                        formatter: function (val, row, index) {
                            var Id = row.Id;
                            return '<a href="#" onclick = "DeleteRow(this);" id = ' + Id + ' rowIndex = ' + index + ' style="color:red;">Delete</a>  '
                                    + '<a href = "CountryCategoryDetail.aspx?act=U&id=' + Id + '">  Eidt</a>';

                        }
                    },
	                { title: '区域代号', field: 'Id', width: 60, sortable: true },
	                { title: '区域名称', field: 'CountryCategory', width: 100, sortable: true }
				]],
                pagination: true,
                //            rownumbers: true,
                singleSelect: true,
                pageList: [10, 15, 20]
            });
        });

        function DeleteRow(row) {
            var rowAttr = $(row);
            var id = rowAttr.attr('id');
            var rowIndex = rowAttr.attr('rowIndex');
            $.messager.confirm("请确认...", "确认删除?", function (value) {
                if (value) {
                    var url = "../../TableHanders.aspx?act=d&tid=51&type=1&id=" + id;
                    $.getJSON(
                        url,
                        function (data) {
                            var sdata = data[0];
                            var code = sdata.code;
                            if (code == 0) {
                                $("#country").datagrid('deleteRow', rowIndex);
                            }
                            else {
                                alert(sdata.msg);
                            }
                        }
                        );
                }
            });
        }         
	</script>	
</head>
<body> 
   <div id="body">
       <form id="formQuery" runat="server">
             <div class="div_Title">
                   <span class="Body_Title">》》<%=this.Title %></span>
             </div>  
             <table  id="country"></table>
       </form>
   </div>
</body>
</html>